/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.evangelion.core.bean;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Kellycasma
 */
@Entity
@Table(name = "declaraciones")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Declaracion.findAll", query = "SELECT d FROM Declaracion d"),
    @NamedQuery(name = "Declaracion.findById", query = "SELECT d FROM Declaracion d WHERE d.id = :id"),
    @NamedQuery(name = "Declaracion.findByFecha", query = "SELECT d FROM Declaracion d WHERE d.fecha = :fecha"),
    @NamedQuery(name = "Declaracion.findByFechadeclaracion", query = "SELECT d FROM Declaracion d WHERE d.fechadeclaracion = :fechadeclaracion")})
public class Declaracion implements Serializable {

    @Column(name = "tipo")
    private String tipo;
    @Column(name = "trimestre")
    private int trimestre;
    @Column(name = "anno")
    private int anno;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "valor_declarado")
    private Double valorDeclarado;
    @Column(name = "valor_total_factura")
    private Double valorTotalFactura;
    @Column(name = "valor_fact_descontar")
    private Double valorFactDescontar;
    @Column(name = "nvo_valor_factura")
    private Double nvoValorFactura;
    @OneToMany(mappedBy = "declaracion", orphanRemoval = true, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private List<MovimientoAux> movimientoAuxList;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @Column(name = "fechadeclaracion")
    @Temporal(TemporalType.DATE)
    private Date fechadeclaracion;
    @JoinColumn(name = "id_seccion", referencedColumnName = "id")
    @ManyToOne
    private Seccione seccion;
    @JoinColumn(name = "id_cliente", referencedColumnName = "id")
    @ManyToOne
    private Cliente cliente;

    public Declaracion() {
    }

    public Declaracion(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Date getFechadeclaracion() {
        return fechadeclaracion;
    }

    public void setFechadeclaracion(Date fechadeclaracion) {
        this.fechadeclaracion = fechadeclaracion;
    }

    public Seccione getSeccion() {
        return seccion;
    }

    public void setSeccion(Seccione seccion) {
        this.seccion = seccion;
    }

    public Cliente getCliente() {
        return cliente;
    }

    public void setCliente(Cliente cliente) {
        this.cliente = cliente;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Declaracion)) {
            return false;
        }
        Declaracion other = (Declaracion) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.evangelion.core.bean.Declaracion[ id=" + id + " ]";
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public Double getValorDeclarado() {
        return valorDeclarado;
    }

    public void setValorDeclarado(Double valorDeclarado) {
        this.valorDeclarado = valorDeclarado;
    }

    public Double getValorTotalFactura() {
        return valorTotalFactura;
    }

    public void setValorTotalFactura(Double valorTotalFactura) {
        this.valorTotalFactura = valorTotalFactura;
    }

    public Double getValorFactDescontar() {
        return valorFactDescontar;
    }

    public void setValorFactDescontar(Double valorFactDescontar) {
        this.valorFactDescontar = valorFactDescontar;
    }

    public Double getNvoValorFactura() {
        return nvoValorFactura;
    }

    public void setNvoValorFactura(Double nvoValorFactura) {
        this.nvoValorFactura = nvoValorFactura;
    }

    @XmlTransient
    public List<MovimientoAux> getMovimientoAuxList() {
        return movimientoAuxList;
    }

    public void setMovimientoAuxList(List<MovimientoAux> movimientoAuxList) {
        this.movimientoAuxList = movimientoAuxList;
    }

    public int getTrimestre() {
        return trimestre;
    }

    public void setTrimestre(int trimestre) {
        this.trimestre = trimestre;
    }

    public int getAnno() {
        return anno;
    }

    public void setAnno(int anno) {
        this.anno = anno;
    }
}
